package com.voc.im.controller.item;

import com.voc.im.bean.UserRoom;
import com.voc.im.model.UserRoomModel;
import io.datafx.controller.FXMLController;
import io.datafx.controller.flow.FlowException;
import javafx.fxml.FXML;
import javafx.scene.control.Label;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.IOException;

@FXMLController("/fxml/main_user_room_item.fxml")
public class ItemRoomController {

    @FXML
    private Label labelItemName;

    @Inject
    private UserRoomModel userRoomModel;

    @PostConstruct
    public void init() throws IOException, FlowException {
        UserRoom userRoom = userRoomModel.getRoomListProperty().get(userRoomModel.getSelectedRoomIndex().get());
        labelItemName.textProperty().bindBidirectional(userRoom.nicknameProperty());
    }

}
